#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pii pair<db,int>
#define pb push_back
#define vec vector<int>
#define y1 y_____hahahaha_____1

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

int read(){int x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); return x * sgn;}

const int N = 3e5+10;

db f[N];
int n,m,deg[N],ceg[N];
vec G[N];
bool vis[N];

void dijk(){
	f[n] = 0; ceg[n] = 1; priority_queue<pii,vector<pii>,greater<pii> > q; q.push(pii(f[n],n));
	while(!q.empty()){
		pii d = q.top(); q.pop(); int x = d.se; if(vis[x]) continue; f[x] /= ceg[x]; vis[x] = 1;
		for(auto y : G[x])
			if(!vis[y]){
				f[y] += f[x]; ceg[y]++; q.push(pii(f[y] / ceg[y],y));
			}
	}
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in,m = in;
	for(int i = 1,u,v;i <= m;i++) u = in,v = in,G[u].pb(v),G[v].pb(u),f[u]++,f[v]++;
	dijk(); printf("%.7lf",f[1]);
	return 0;
}
